class Animal {
    protected String name;
    public Animal(String name){
        this.name=name;
    }
}
interface IFlying{
    void fly();
}

interface IRunning{
    void run();
}

interface ISwimming{
    void swim();
}

class Cat extends Animal implements IRunning{

    public Cat(String name){
        super(name);
    }
    public void run(){
        System.out.println(this.name+"正在用四条腿跑步");
    }
}

class Fish extends Animal implements ISwimming{

    public Fish(String name){
        super(name);
    }
    public void swim(){
        System.out.println(this.name+"正在用尾巴游泳");
    }
}

class Frog extends Animal implements ISwimming,IRunning{
    public Frog(String name){
        super(name);
    }
    public void swim(){
        System.out.println(this.name+"正在蹬腿游泳");
    }
    public void run(){
        System.out.println(this.name+"正在往前跳");
    }
}

class Duck extends Animal implements ISwimming,IRunning,IFlying{
    public Duck(String name){
        super(name);
    }
    public void swim(){
        System.out.println(this.name+"正飘在水上");
    }
    public void run(){
        System.out.println(this.name+"正在用两条腿跑");
    }
    public void fly(){
        System.out.println(this.name+"正在用翅膀飞");
    }
}
public class Main {
    static void walk(IRunning run){
        run.run();
    }
    public static void main(String[] args) {
        Cat cat=new Cat("小猫");
        walk(cat);
        Frog frog=new Frog("小青蛙");
        walk(frog);
    }
}